<script type="text/javascript">
var <?= $this->grid->jsObject ?> = {
	expand: function(subgridId, rowId) {
		var grid = $("#<?= $this->grid->tableId ?>");
		var rowData = grid.jqGrid('getRowData', rowId);
		var isEnum = parseInt(rowData.enum_value);
		if (isEnum > 0) {
            var tableId = subgridId + 't';
            var pagerId = subgridId + 'p';

			var options = <?= $this->subgrid->renderOptions() ?>;
			options = $.extend(options, {
				url: options.url + '?' + $.param({id: rowId}),
				pager: pagerId,
                editurl: options.editurl + '?' + $.param({id: rowId})
			});
			$("#" + subgridId).html("<div style='padding:5px'><table id='" + tableId + "' class='scroll'></table><div id='" + pagerId + "'></div></div>");
			$("#" + tableId).jqGrid(options);
			$("#" + tableId).jqGrid("navGrid", "#" + pagerId, <?= $this->subgrid->renderNavGridButtons() ?>);
		} else {
			$("#" + subgridId).append("<p>нет данных</p>");
		}
	},
	collapse: function(subgridId, rowId) {}
};

</script>
<?= $this->grid ?>